package com.android.aircondition.utils;

import java.math.BigDecimal;
import java.text.DecimalFormat;

public class CommonUtils {
	
	/**
	 * @param  f , source data
	 * @return float 
	 * */
	
	public static float halfRound(float f){
		
		java.math.BigDecimal bigDecimal = new BigDecimal(String.valueOf(f));
		
		int scale = 1;
		
		double dResult = bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
		
		DecimalFormat df = new DecimalFormat("0.0");
		
	    String s = df.format(dResult);
	    
	    f = Float.valueOf(s);
	    
		return f;
	}

}
